package com.lxy.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lxy.bean.Customer;
import com.lxy.common.bean.PageBean;
import com.lxy.common.crud.BaseServiceImpl;
import com.lxy.mapper.CustomerMapper;
import com.lxy.query.CustomerQuery;
import com.lxy.service.CustomerService;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class CustomerServiceImpl extends BaseServiceImpl<Customer, CustomerMapper> implements CustomerService{
    @Override
    public PageBean query(CustomerQuery query) {
        //分页查询
        PageHelper.startPage(query.getPage(), query.getPageSize()); //后面紧跟查询
        List list  = baseMapper.query(query);
        PageInfo info  = new PageInfo<>(list);
        return new PageBean(query.getPage(),query.getPageSize(),info.getTotal(),list);
    }
}
